<template>
  <div>
    <el-card shadow="always" class="box-card">
      <div class="tableTitle"><span>基本信息</span></div>
      <div class="devTitle"><span>{{detailInfo.planName}}</span></div>
      <div>
        <div class="tableStyle">
          <div class="labelS">记录编号</div>
          <div class="contentS">{{detailInfo.planNum}}</div>
          <div class="labelS">任务编号</div>
          <div class="contentS">{{detailInfo.taskNum}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">计划名称</div>
          <div class="contentS">{{detailInfo.planName}}</div>
          
        </div>
        <div class="tableStyle">
          <div class="labelS">开始时间</div>
          <div class="contentS">{{detailInfo.planBeginTime}}</div>
          <div class="labelS">计划结束数据</div>
          <div class="contentS">{{detailInfo.planEndTime}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">任务状态</div>
          <div class="contentS">
              <span class="nocomplate">{{detailInfo.statusC}}</span>
              </div>
         
        </div>
        <div class="tableStyle">
          <div class="labelS">备注</div>
          <div class="contentS">
            {{detailInfo.remark}}
          </div>
        </div>
        <!-- <div class="tableStyle">
          <div class="labelS">负责人</div>
          <div class="contentS">
            王晓伟
          </div>
        </div> -->
      </div>
    </el-card>
   
    <el-card shadow="always" class="box-card">
      <div class="tableTitle"><span>巡检情况</span></div>
      <el-table :data="tableData2" border style="width: 100%">
        
        <el-table-column prop="deviceNum" label="设备编号" width="150" >
        </el-table-column>
        <el-table-column prop="deviceName" label="设备名称" width="150"> </el-table-column>
        <el-table-column prop="inspectionTime" label="检验时间" width="150"> </el-table-column>
        <el-table-column prop="person" label="巡检人"> </el-table-column>
        <el-table-column prop="inspectImgId" label="记录图片"  > </el-table-column>
        <el-table-column prop="remark" label="说明"> </el-table-column>
        <el-table-column prop="itemsName" label="检验项"> </el-table-column>
        <el-table-column prop="inspectVal" label="点检值"> </el-table-column>
        <el-table-column prop="abnormal" label="是否异常"> </el-table-column>

         <el-table-column prop="isresolve" label="异常是否处理"   width="150"> </el-table-column>
        <el-table-column prop="solution" label="处理措施"> </el-table-column>
        <el-table-column prop="remark" label="备注"> </el-table-column>
        <el-table-column prop="inspectImgId" label="图片"> </el-table-column>
       
      </el-table>
      <div style="text-align:right;margin-top:20px;">
                <el-pagination
  background
  :pager-count="5"
  layout="total,prev, pager, next"

 :page-size="pageSize"
 @current-change="handleCurrentChange"
 :current-page.sync="currentPage"
  :total="total">
</el-pagination>
            </div>
        
    </el-card>
  </div>
</template>
<script>
 import {getObj,selectdevAll} from "@/api/ems/inspection/task";
export default {
  data() {
    return {
      tableData: [],
      tableData2: [],
      detailInfo:{},
      id:'',
       pageSize:5,
                currentPage:1,
                total:0,
      task: [{
    label: '未开始',
    value: '0'
  }, {
    label: '执行中',
    value: '1'
  },
  {
    label: '待核验',
    value: '2'
  },
  {
    label: '已完成',
    value: '3'
  },
  {
    label: '已过期',
    value: '4'
  },
],
    };
  },
  mounted(){
    this.id = this.$route.query.id;
    this.getDetailinfo();
    this.selectdevAll();
  },
  methods:{
    getDetailinfo(){
      getObj(this.id).then((res) => {
        
        this.detailInfo = res.data.data;
        let obj = this.task.find((item)=>item.value==this.detailInfo.status)
         this.detailInfo.statusC = obj.label
      //   console.log(this.detailInfo)
      });
    },
      selectdevAll(){
selectdevAll({taskId:this.id,size:this.pageSize,current:this.currentPage}).then((res)=>{
           
          if( res.data.data){
           this.tableData2=res.data.data.records;
            this.total = res.data.data.total;
          }
        })
       },
        handleCurrentChange(index){
      this.currentPage = index;
      this.selectdevAll();
    }, 
  }
};
</script>
<style lang="scss" scoped>
.tableTitle {
  color: #333;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 20px;
}
.devTitle {
  color: #262626;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
}
.box-card {
  margin-bottom: 10px;
  .el-card__body {
    padding-top: 10px;
  }
  .labelS {
    //display: inline-block;
    flex:0 0 150px;
    //height: 40px;
    // margin-right: 10px;
    text-align: left;
    color: #606266;
    padding: 10px;
    border: 1px solid rgba(236, 240, 244, 100);
    margin-bottom: -1px;
  }
  .contentS {
    border: 1px solid rgba(236, 240, 244, 100);
    // height: 40px;
    color: #606266;
    width: 100%;
    margin-left: -1px;
    margin-bottom: -1px;
    padding: 10px;
    // margin: 10px 0;
    // width: calc(100% - 120px);
    // display: inline-block;
  }
  .tableStyle {
    display: flex;
  }
  .number{
      font-weight: bold;
      margin-top: 5px;
      font-size: 16px;
  }
  .nocomplate{
      color: white;
      background-color: #E83672;
      padding: 3px 5px;
      border-radius: 3px;
      font-size: 12px;
  }
}
</style>
